home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / cbibcode.arc / SIN.C < prev    next >
Encoding:
C/C++ Source or Header  |  1991-08-05  |  378 b   |  20 lines

  1.  /* sin.c from page 242*/
  2.  #include <stdio.h>
  3.  #include <stdlib.h>
  4.  #include <math.h>
  5.  #define R_TO_D  57.29578        /*radians to degrees */
  6.  main(int argc, char **argv)
  7.  {
  8.     double  result;
  9.     if(argc < 2)
  10.     {
  11.         printf("usage: %s <degree>\n", argv[0]);
  12.  
  13.     }
  14.     else
  15.     {
  16.         result = sin(atof(argv[1]) / R_TO_D);
  17.         printf("sine (%s deg.) = %f\n",
  18.         argv[1], result);
  19.     }
  20.  }